<template>
  <div class="c-bg-white c-ph24">
    <div class="c-flex-row c-justify-sb c-pv30 c-bd-b1-f6">
      <div class="c-fs26 c-fc-sblack c-ww160">店铺名称</div>
      <div class="c-fs26 c-fc-xblack c-w0 c-flex-grow1 c-text-ellipsis1 c-textAlign-r">{{shopInfo.companyName}}</div>
    </div>
    <div class="c-flex-row c-justify-sb c-pv30 c-bd-b1-f6">
      <div class="c-fs26 c-fc-sblack c-ww160">开店时间</div>
      <div class="c-fs26 c-fc-xblack c-w0 c-flex-grow1 c-text-ellipsis1 c-textAlign-r">{{shopInfo.createdAt && shopInfo.createdAt.substr(0,10)}}</div>
    </div>
    <div class="c-flex-row c-justify-sb c-pv30 c-bd-b1-f6">
      <div class="c-fs26 c-fc-sblack c-ww160">店铺主体类型</div>
      <div class="c-fs26 c-fc-xblack c-w0 c-flex-grow1 c-text-ellipsis1 c-textAlign-r">{{getMainBodyType(shopInfo.mainBodyType)}}</div>
    </div>
    <div class="c-flex-row c-justify-sb c-pv30 c-bd-b1-f6">
      <div class="c-fs26 c-fc-sblack c-ww160">主体认证</div>
      <div class="c-fs26 c-fc-xblack c-w0 c-flex-grow1 c-flex-row c-aligni-center c-justify-end">
        <div class="c-fs26 c-fc-xblack">{{ getMainBodyText() }}</div>
        <div v-if="shopInfo.mainBodyType == 1" class="c-fs20 theme-fc c-ww76 c-hh32 c-flex-row c-flex-center theme-bd1 theme-bg-10 c-br8 c-ml14">已认证</div>
      </div>
    </div>
    <div v-if="shopInfo.businessRange" class="c-flex-row c-justify-sb c-pv30 c-bd-b1-f6">
      <div class="c-fs26 c-fc-sblack c-ww160 c-flex-shrink0">经营类型</div>
      <div class="c-fs26 c-fc-xblack">{{shopInfo.businessRange}}</div>
    </div>
  </div>
</template>

<script>
import { utilJs } from "@/utils/common.js"
export default {
  name: 'MyShopInfo',
  components: {
  },
  props: [],
  beforeCreate() {

  },
  data() {
    return {
      shopInfo: ''
    }
  },
  created() {
    utilJs.appShare(this);
  },
  mounted() {

  },
  computed: {

  },
  watch: {

  },
  methods: {
    getShopDetail() {
      utilJs.getMethod(`${global.apiurl}company/shopDetail`, (res) => {
        if (JSON.stringify(res) == '[]') {
          this.$routerGo(this, "replace", { path: "/member/memberIndex" });
        } else {
          this.shopInfo = res;
        }
      });
    },
    getMainBodyType(MainBodyType) {
      let mainBodyTypeText = ''
      if (MainBodyType == 1) {
        mainBodyTypeText = '个人'
      }
      if (MainBodyType == 2) {
        mainBodyTypeText = '个体工商户'
      }
      if (MainBodyType == 3) {
        mainBodyTypeText = '企业'
      }
      return mainBodyTypeText;
    },
    getMainBodyText() {
      let mainBodyText = '';
      if (this.shopInfo.mainBodyType == 1) {
        mainBodyText = this.shopInfo.mainBody ? this.shopInfo.mainBody.substr(0, 1) + '**' : ''
      } else {
        mainBodyText = this.shopInfo.mainBody;
      }
      return mainBodyText;
    }
  },
  activated() {
    setDocumentTitle("店铺信息");// eslint-disable-line
    this.getShopDetail();
  },
  deactivated() {
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
